package socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class HwCC08Client {

	static Socket server;

	public static void main(String[] args) {
		try {
			server = new Socket(InetAddress.getLocalHost(), 6789);
			BufferedReader in = new BufferedReader(new InputStreamReader(server.getInputStream()));
			PrintWriter out = new PrintWriter(server.getOutputStream());
			BufferedReader wt = new BufferedReader(new InputStreamReader(System.in));
			int i = 0;
			while (true) {
				i++;
				//String str = wt.readLine();
				//out.println(i + "------xixixiixiixixixixixiixixixixixixixixiixxi");
				//out.flush();
				//if ("end".equals(str)) {
				//	break;
				//}
				StringBuffer sb = new StringBuffer();
				String va = "";
				do{
        			va = in.readLine();
        			sb.append(va.trim());
        		}while(va.indexOf("---END")==-1);
				System.out.println(va + " ======" + i);
			}
			//server.close();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
